<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Upload Excel</title>
<script>
		 function submitCheck(){
			   if(document.getElementsByName("theFile")[0].value.length>1){
			   var image = document.getElementsByName("theFile")[0].value;
			   var i = image.indexOf(".");
		       var name = image.substring(i+1);
               if(!findExt(name)){
                  alert("请选择xls文件！");
                  return false;
               }
               }
		 document.forms[0].submit();
		 }
	  function findExt(ext){
		var es = new Array();
		es[0] = "xls";
        var i;
		for(i=0;i<es.length;i++){
		if(ext==es[i]){
		return true;
		}
		} 
		return false;
		}
		</script>
</head>
<body>
<html:form method="post" enctype="multipart/form-data"
	action="excel.do?method=doUploadFile">
	<table>
		<tr>
			<td>UploadFile:</td>
			<td><html:file property="theFile" /></td>
			<td><input name="Submit" type="button"  value="提交" onclick="javascript:submitCheck()"></td>
	</tr>
</table>
</html:form>
</body>
</html>